//
//  LegalPersonTableViewCell.m
//  Village
//
//  Created by longrise on 2017/9/11.
//  Copyright © 2017年 程虎. All rights reserved.
//

#import "LegalPersonTableViewCell.h"

#import "Masonry.h"
@implementation LegalPersonTableViewCell

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self addAllViews];
        
    }
    return self;
}

- (void)addAllViews
{
    _leftiamge = [[UIImageView alloc] init];
    [self addSubview:_leftiamge];
    [_leftiamge mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(8*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.width.mas_equalTo(90*kScreenScaleX);
        make.height.mas_equalTo(90*kScreenScaleX);
        make.centerY.equalTo(self);
    }];
    
    _namelable = [[UILabel alloc] init];
    _namelable.text = @"我的文章";
    _namelable.textColor = K_TitlesColor;
    _namelable.backgroundColor = [UIColor whiteColor];
    _namelable.font = [UIFont systemFontOfSize:17*kScreenScaleX];
    [_namelable setTextAlignment : NSTextAlignmentLeft] ;
    [self addSubview:_namelable];
    [_namelable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_leftiamge.mas_right).offset(15*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_leftiamge.mas_top).offset(-3*kScreenScaleY);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(60*kScreenScaleX);
        make.height.mas_equalTo(20*kScreenScaleY);
          }];
    _messagelable = [[UILabel alloc] init];
    _messagelable.text = @"男   汉族    本科";
    _messagelable.textColor = [Util colorWithHexString:@"#666666"];
    _messagelable.backgroundColor = [UIColor whiteColor];
    _messagelable.font = [UIFont systemFontOfSize:14*kScreenScaleX];
    [_messagelable setTextAlignment : NSTextAlignmentLeft] ;
    [self addSubview:_messagelable];
    [_messagelable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_leftiamge.mas_right).offset(15*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_namelable.mas_bottom).offset(10*kScreenScaleY);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(180*kScreenScaleX);
        make.height.mas_equalTo(20*kScreenScaleY);
    }];
    _phonelable = [[UILabel alloc] init];
    _phonelable.text = @"我的文章";
    _phonelable.textColor = [Util colorWithHexString:@"#666666"];
    _phonelable.backgroundColor = [UIColor whiteColor];
    _phonelable.font = [UIFont systemFontOfSize:14*kScreenScaleX];
    [_phonelable setTextAlignment : NSTextAlignmentLeft] ;
    [self addSubview:_phonelable];
    [_phonelable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_leftiamge.mas_right).offset(15*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_messagelable.mas_bottom).offset(4*kScreenScaleY);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(180*kScreenScaleX);
        make.height.mas_equalTo(20*kScreenScaleY);
    }];
    _personlable = [[UILabel alloc] init];
    _personlable.text = @"我的文章";
    _personlable.textColor = [Util colorWithHexString:@"#666666"];
    _personlable.backgroundColor = [UIColor whiteColor];
    _personlable.font = [UIFont systemFontOfSize:14*kScreenScaleX];
    [_personlable setTextAlignment : NSTextAlignmentLeft] ;
    [self addSubview:_personlable];
    [_personlable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_leftiamge.mas_right).offset(15*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_phonelable.mas_bottom).offset(4*kScreenScaleY);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(180*kScreenScaleX);
        make.height.mas_equalTo(20*kScreenScaleY);
    }];
    
    _rightimage = [[UIImageView alloc] init];
    _rightimage.image = [UIImage imageNamed:@"query"];
    [self addSubview:_rightimage];
    [_rightimage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-8*kScreenScaleX);//使左边等于self.view的左边，间距为0
//        make.top.equalTo(self.mas_top).offset(8*kScreenScaleX);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(50*kScreenScaleX);
        make.height.mas_equalTo(50*kScreenScaleX);
          make.top.equalTo(_leftiamge);
    }];
    _xuxianview = [[UIView alloc] init];
    _xuxianview.backgroundColor = kBackgroundColor;
    [self addSubview:_xuxianview];
    [_xuxianview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(8*kScreenScaleX);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_leftiamge.mas_bottom).offset(10*kScreenScaleY);//使顶部与self.ScrollWebView的底部间距为0
        make.width.mas_equalTo(356*kScreenScaleX);
        make.height.mas_equalTo(2*kScreenScaleY);
    }];
    
}
- (void)setRefer:(ReferModel *)refer{
    
    _namelable.text = refer.name;
    NSString *str = [NSString stringWithFormat:@"%@  %@  %@",refer.sexcn,refer.nationcn,refer.educationcn];
    _messagelable.text = str;
    _phonelable.text = refer.phone;
    _personlable.text = refer.cardno;
    NSString *str1 = [NSString stringWithFormat:@"%@query",refer.persontype];
    _rightimage.image = [UIImage imageNamed:str1];
    _leftiamge.image = [UIImage imageNamed:@"default_img"];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
